//服务层
app.service('goodsService',function($http){

    //1.添加商品
    this.add=(entity)=>{
        return $http.post("../goods/add.do",entity);
    }
    //根据父id查分类列表
    this.findByParenId=(parentId)=>{
        return $http.get("../goods/findByParentId.do?parentId="+parentId);
    }
    //分页显示商品信息
    this.findAllPage=(page,pageSize)=>{
        return $http.get("../goods/findPage.do?page="+page+"&pageSize="+pageSize);
    }
    //查找一个商品信息
    this.findOne=(goodsId)=>{
        return $http.get("../goods/findOne.do?id="+goodsId)
    }
    //保存商品
    this.save=(url,entity)=>{
        return $http.post(url,entity);
    }
});
